import React from 'react'
import ReactDOM from 'react-dom/client'
import { RouterProvider } from 'react-router-dom'
import { ConfigProvider, App, Skeleton } from 'antd'
import zhCN from 'antd/locale/zh_CN'
import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn'
import 'virtual:uno.css'
import 'antd/dist/reset.css'
import '@/styles/index.less'
import router from './router'
import { StaticMethod, toAnotherPx } from '@hs-admin/utils'

dayjs.locale('zh-cn')

const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement)

root.render(
  <React.StrictMode>
    <ConfigProvider
      locale={zhCN}
      theme={{
        token: {
          fontSize: toAnotherPx(14),
          controlHeight: toAnotherPx(32),
          sizePopupArrow: toAnotherPx(16),
          size: toAnotherPx(16),
          controlInteractiveSize: toAnotherPx(16),
          controlPaddingHorizontal: toAnotherPx(12),
          margin: toAnotherPx(16),
          padding: toAnotherPx(16),
          paddingContentHorizontal: toAnotherPx(16),
          paddingContentVertical: toAnotherPx(12)
        },
        components: {
          Layout: {
            headerBg: '#fff'
          }
        }
      }}>
      <App>
        <StaticMethod />
        <RouterProvider router={router} fallbackElement={<Skeleton active />} />
      </App>
    </ConfigProvider>
  </React.StrictMode>
)
